package com.sesame.controller;

import com.alibaba.nacos.api.annotation.NacosInjected;
import com.alibaba.nacos.api.naming.NamingService;
import com.alibaba.nacos.api.naming.pojo.Instance;
import com.sesame.defin.AbstractController;
import com.sesame.defin.Response;
import com.sesame.entity.User;
import com.sesame.feign.FeignServiceTest;
import com.sesame.service.TestService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

@RestController
public class TestController extends AbstractController {

    @Autowired
    FeignServiceTest feignServiceTest;

    /**
     * http://localhost:8096/getData?name=1&pwd=bbb
     */
    @RequestMapping("/getData")
    public ApiResult<User> getData(String name, String pwd) {
        Response<User> json = feignServiceTest.test(name, pwd);
        return json;
    }

    @Autowired
    private TestService testService;

    @RequestMapping("/hello")
    public String hello() {
        String str = testService.doSomeThing("hello " + new Date());
        return str;
    }

    @GetMapping("/hello2")
    public String hello2() {
        String str = testService.doSomeThing2("hello2 " + new Date());
        return str;
    }
}
